/**
 * 
 */
package chess;

import game.Game;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Max
 *
 */
public class Player {

	private List<Piece> myPieces;
	private java.util.List<Piece> trophyKills;
	private String name;
	protected Game currentGame;
	private String colour;

	
	/**
	 * Generate a new player.  
	 * <pre>
	 * Max Joyce
	 * -Made basic constructor (Jan 21,2010)
	 * -Added colour field (Jan 22,2010)
	 * </pre>
	 * @param name The name of the player
	 * @param colour The players colour.  This should be either "White" or "Black"
	 */
	public Player(String name, Game game, String colour) {
		
		myPieces = new ArrayList<Piece>();
		trophyKills=new ArrayList<Piece>();
		this.name=name;
		this.currentGame=game;
		this.colour = colour;
		
	}

	 /**
	  * @return Returns the current players name
	  * <pre>
	  * Max Joyce 
	  * -Made method.  Hopefully I haven't made a mistake somehow (Jan 21,2010)
	  * </pre>
	  */
	 public String getName(){
		 return this.name;
	 }

	 /**
	  * @return Returns the current players colour
	  * <pre>
	  * Max Joyce 
	  * -Made method.  Hopefully I haven't made a mistake somehow (Jan 22,2010)
	  * </pre>
	  */
	 public String getColour(){
		 return this.colour;
	 }
	 
	 /**
	  * @return Returns the  players currentGame
	  * <pre>
	  * Samual Martelli 
	  * -Created method.(Feb 24,2010)
	  * </pre>
	  */
	 public Game getGame(){
		 return this.currentGame;
	 }
	 
	/**
	 * This will allow the player to move a specified piece
	 * <pre>
	 * Max Joyce
	 * -Created method signature (Jan 21,2010)
	 * </pre>
	 * @param p The piece to be moved
	 */
	public void movePiece(Piece p) {
		
	}

	/**
	 * 
	 * Gets a list of the players pieces
	 * <pre>
	 * Max Joyce 
	 * -Made the method (Jan 21,2010)
	 * </pre>
	 * @return List of the players pieces
	 */
	public List<Piece> getMyPieces() {
		return myPieces;
	}

	/**
	 * 
	 * Gets a list of all pieces that have been killed by the player
	 * <pre>
	 * Max Joyce 
	 * -Made the method (Jan 21,2010)
	 * </pre>
	 */
	public java.util.List<Piece> getKills() {
		return trophyKills;
	}
	
	/**
	 *  Adds a specified piece to the players graveyard
	 *  <pre>
	 *  Max Joyce
	 *  -Made the method (Jan 21,2010)
	 *  </pre>
	 * @param p The piece that was killed
	 */
	public void addKill(Piece p){
		trophyKills.add(p);
	}

	/**
	 * This will simply call the game take turn method.
	 * <pre>
	 * Max Joyce
	 * -Method created (Feb 9, 2010)
	 * </pre>
	 * 
	 */
	public void takeTurn(){
		this.currentGame.takeTurn(this);
	}
	
	 /**
	  * This function sets the player's game to the current game 
	  *  <pre>
	  * Samual Martelli
	  * -commented(March 23,2010)
	  * </pre>
	  */
	public void setGame(game.Game currentGame){
		this.currentGame=currentGame;
	}
	
	 /**
	  * This function resets the player's pieces
	  *  <pre>
	  * Samual Martelli
	  * -commented(March 23,2010)
	  * </pre>
	  */
	public void resetMyPieces(){
		myPieces = new ArrayList<Piece>();
	}
}
